package org.jiamandan.com.strategy.impl.car.listener;

import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONObject;
import io.netty.channel.Channel;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.jiamandan.com.constant.YxConstant;
import org.jiamandan.com.dto.YXBasicDto;
import org.jiamandan.com.entity.RechargeGun;
import org.jiamandan.com.service.IRechargeGunService;
import org.jiamandan.com.strategy.impl.car.IYXContextListener;
import org.springframework.stereotype.Service;

import java.util.List;

/**

 * @功能说明：计费模板应答

 */
@Service(value = YxConstant.Service.CMD_57)
@AllArgsConstructor
@Slf4j
public class YxModelListener implements IYXContextListener {
    private IRechargeGunService iRechargeGunService;

    @Override
    public void doExecute(YXBasicDto dto, Channel client) throws Exception {
        log.info("JMD-YX接收计费模板应答(CMD=57):"+ JSONObject.toJSONString(dto));
        String pileNo = StringUtils.substring(dto.getData(), 0, 14);
        String result = StringUtils.substring(dto.getData(), 14, 16);
        //TODO 存储设备计费模型
    }
}
